package com.share.dubbo.ssm;

import com.share.common.utils.IpUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/*dubbo服务的启动类*/
@Slf4j
public class MainSsm {
    public static void main(String[] args) {
        String ip = IpUtil.getIp();
        MDC.put("ip",ip);
        System.setProperty("dubbo.protocol.host", ip);
        System.setProperty("DUBBO_IP_TO_REGISTRY", ip);
        System.setProperty("DUBBO_IP_TO_BIND", ip);
        log.info("把ip设置到dubbo.protocol.host系统参数中,ip={}", ip);

        new ClassPathXmlApplicationContext(new String[]{"classpath*:application-context.xml"});
        log.info("ssm dubbo服务启动成功!");
        while (true) ;
    }
}
